export class Ball{
    constructor(options, {x = 0, y = 0, vx = 0, vy = 0, rotation = 0, color = 'red', ctx = null, radius = 10} = options){
        Object.assign(this, {x, y, vx, vy, color, rotation, ctx, radius, options})
    }

    draw(ctx = null){
        ctx = ctx || this.ctx
        ctx.save()
        ctx.translate(this.x,this.y)
        ctx.rotate(this.rotation)
        ctx.fillStyle = this.color
        ctx.lineStyle = 'black'
        ctx.beginPath()
        ctx.arc(0, 0, this.radius, 0, Math.PI * 2, false)
        ctx.fill()
        ctx.moveTo(-this.radius, 0)
        ctx.lineTo(this.radius, 0)
        ctx.stroke()
        ctx.restore()
    }
}